'use strict';
import {
  bindDevice, unbindDevice, findBindDevices,
  bindMeter, unbindMeter, findBindMeters,
  bindUsers, findBindUsers, unbindUser
} from "../services/organization";

export default {
  namespace: 'organization',
  state: {},
  effects: {
    * findBindDevices({payload}, {call, put}) {
      const response = yield call(findBindDevices, payload);
      if (response) {
        return response;
      }
    },

    * bindDevice({payload}, {call, put}) {
      const response = yield call(bindDevice, payload);
      if (response) {
        return response;
      }
    },
    * unbindDevice({payload}, {call, put}) {
      const response = yield call(unbindDevice, payload);
      if (response) {
        return response;
      }
    },

    * findBindMeters({payload}, {call, put}) {
      const response = yield call(findBindMeters, payload);
      if (response) {
        return response;
      }
    },

    * bindMeter({payload}, {call, put}) {
      const response = yield call(bindMeter, payload);
      if (response) {
        return response;
      }
    },
    * unbindMeter({payload}, {call, put}) {
      const response = yield call(unbindMeter, payload);
      if (response) {
        return response;
      }
    },


    * bindUsers({payload}, {call, put}) {
      const response = yield call(bindUsers, payload);
      if (response) {
        return response;
      }
    },
    * unbindUser({payload}, {call, put}) {
      const response = yield call(unbindUser, payload);
      if (response) {
        return response;
      }
    },
    * findBindUsers({payload}, {call, put}) {
      const response = yield call(findBindUsers, payload);
      if (response) {
        return response;
      }
    },
  },

  reducers: {},

};
